<template>
	<div class="wrap">
		<el-form
			ref="forms"
			size="small"
			:model="forms"
			:rules="rules"
			label-position="right"
			label-width="auto"
			class="custom-form"
		>
			<el-card shadow="never" :border="false">
				<div slot="header" class="info-tlt">选手信息</div>
				<el-row type="flex" align="middle">
					<el-form-item label="选手姓名：" prop="player_name">
						<el-input
							v-model="forms.player_name"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="姓名X坐标：" prop="player_name_left">
						<el-input
							v-model="forms.player_name_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="姓名Y坐标" prop="player_name_top">
						<el-input
							v-model="forms.player_name_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="参赛号：" prop="race_num">
						<el-input v-model="forms.race_num" placeholder="请输入" clearable style="width: 100%" />
					</el-form-item>
					<el-form-item label="参赛号X坐标：" prop="race_num_left">
						<el-input
							v-model="forms.race_num_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="参赛号Y坐标" prop="race_num_top">
						<el-input
							v-model="forms.race_num_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="性别：" prop="player_sex">
						<el-input
							v-model="forms.player_sex"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="性别X坐标：" prop="player_sex_left">
						<el-input
							v-model="forms.player_sex_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="性别Y坐标" prop="player_sex_top">
						<el-input
							v-model="forms.player_sex_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
			</el-card>

			<el-card shadow="never" :border="false">
				<div slot="header" class="info-tlt">赛事成绩</div>
				<el-row type="flex" align="middle">
					<el-form-item label="5KM(净)：" prop="result_5">
						<el-input v-model="forms.result_5" placeholder="请输入" clearable style="width: 100%" />
					</el-form-item>
					<el-form-item label="5KM(净)X坐标：" prop="result_5_left">
						<el-input
							v-model="forms.result_5_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="5KM(净)Y坐标" prop="result_5_top">
						<el-input
							v-model="forms.result_5_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="5KM(枪)：" prop="result_5_gun">
						<el-input
							v-model="forms.result_5_gun"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="5KM(枪)X坐标：" prop="result_5_gun_left">
						<el-input
							v-model="forms.result_5_gun_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="5KM(枪)Y坐标" prop="result_5_gun_top">
						<el-input
							v-model="forms.result_5_gun_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="10KM(净)：" prop="result_10">
						<el-input
							v-model="forms.result_10"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="10KM(净)X坐标：" prop="result_10_left">
						<el-input
							v-model="forms.result_10_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="10KM(净)Y坐标" prop="result_10_top">
						<el-input
							v-model="forms.result_10_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="10KM(枪)：" prop="result_10_gun">
						<el-input
							v-model="forms.result_10_gun"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="10KM(枪)X坐标：" prop="result_10_gun_left">
						<el-input
							v-model="forms.result_10_gun_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="10KM(枪)Y坐标" prop="result_10_gun_top">
						<el-input
							v-model="forms.result_10_gun_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="15KM(净)：" prop="result_15">
						<el-input
							v-model="forms.result_15"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="15KM(净)X坐标：" prop="result_15_left">
						<el-input
							v-model="forms.result_15_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="15KM(净)Y坐标" prop="result_15_top">
						<el-input
							v-model="forms.result_15_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="15KM(枪)：" prop="result_15_gun">
						<el-input
							v-model="forms.result_15_gun"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="15KM(枪)X坐标：" prop="result_15_gun_left">
						<el-input
							v-model="forms.result_15_gun_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="15KM(枪)Y坐标" prop="result_15_gun_top">
						<el-input
							v-model="forms.result_15_gun_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="20KM(净)：" prop="result_20">
						<el-input
							v-model="forms.result_20"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="20KM(净)X坐标：" prop="result_20_left">
						<el-input
							v-model="forms.result_20_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="20KM(净)Y坐标" prop="result_20_top">
						<el-input
							v-model="forms.result_20_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="20KM(枪)：" prop="result_20_gun">
						<el-input
							v-model="forms.result_20_gun"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="20KM(枪)X坐标：" prop="result_20_gun_left">
						<el-input
							v-model="forms.result_20_gun_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="20KM(枪)Y坐标" prop="result_20_gun_top">
						<el-input
							v-model="forms.result_20_gun_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="21.0975KM(净)：" prop="result_21">
						<el-input
							v-model="forms.result_21"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="21.0975KM(净)X坐标：" prop="result_21_left">
						<el-input
							v-model="forms.result_21_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="21.0975KM(净)Y坐标" prop="result_21_top">
						<el-input
							v-model="forms.result_21_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="21.0975KM(枪)：" prop="result_21_gun">
						<el-input
							v-model="forms.result_21_gun"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="21.0975KM(枪)X坐标：" prop="result_21_gun_left">
						<el-input
							v-model="forms.result_21_gun_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="21.0975KM(枪)Y坐标" prop="result_21_gun_top">
						<el-input
							v-model="forms.result_21_gun_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="25KM(净)：" prop="result_25">
						<el-input
							v-model="forms.result_25"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="25KM(净)X坐标：" prop="result_25_left">
						<el-input
							v-model="forms.result_25_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="25KM(净)Y坐标" prop="result_25_top">
						<el-input
							v-model="forms.result_25_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="25KM(枪)：" prop="result_25_gun">
						<el-input
							v-model="forms.result_25_gun"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="25KM(枪)X坐标：" prop="result_25_gun_left">
						<el-input
							v-model="forms.result_25_gun_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="25KM(枪)Y坐标" prop="result_25_gun_top">
						<el-input
							v-model="forms.result_25_gun_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="30KM(净)：" prop="result_30">
						<el-input
							v-model="forms.result_30"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="30KM(净)X坐标：" prop="result_30_left">
						<el-input
							v-model="forms.result_30_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="30KM(净)Y坐标" prop="result_30_top">
						<el-input
							v-model="forms.result_30_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="30KM(枪)：" prop="result_30_gun">
						<el-input
							v-model="forms.result_30_gun"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="30KM(枪)X坐标：" prop="result_30_gun_left">
						<el-input
							v-model="forms.result_30_gun_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="30KM(枪)Y坐标" prop="result_30_gun_top">
						<el-input
							v-model="forms.result_30_gun_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>

				<el-row type="flex" align="middle">
					<el-form-item label="35KM(净)：" prop="result_35">
						<el-input
							v-model="forms.result_35"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="35KM(净)X坐标：" prop="result_35_left">
						<el-input
							v-model="forms.result_35_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="35KM(净)Y坐标" prop="result_35_top">
						<el-input
							v-model="forms.result_35_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="35KM(枪)：" prop="result_35_gun">
						<el-input
							v-model="forms.result_35_gun"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="35KM(枪)X坐标：" prop="result_35_gun_left">
						<el-input
							v-model="forms.result_35_gun_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="35KM(枪)Y坐标" prop="result_35_gun_top">
						<el-input
							v-model="forms.result_35_gun_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>

				<el-row type="flex" align="middle">
					<el-form-item label="40KM(净)：" prop="result_40">
						<el-input
							v-model="forms.result_40"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="40KM(净)X坐标：" prop="result_40_left">
						<el-input
							v-model="forms.result_40_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="40KM(净)Y坐标" prop="result_40_top">
						<el-input
							v-model="forms.result_40_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="40KM(枪)：" prop="result_40_gun">
						<el-input
							v-model="forms.result_40_gun"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="40KM(枪)X坐标：" prop="result_40_gun_left">
						<el-input
							v-model="forms.result_40_gun_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="40KM(枪)Y坐标" prop="result_40_gun_top">
						<el-input
							v-model="forms.result_40_gun_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>

				<el-row type="flex" align="middle">
					<el-form-item label="42.195KM(净)：" prop="result_42">
						<el-input
							v-model="forms.result_42"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="42.195KM(净)X坐标：" prop="result_42_left">
						<el-input
							v-model="forms.result_42_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="42.195KM(净)Y坐标" prop="result_42_top">
						<el-input
							v-model="forms.result_42_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="42.195KM(枪)：" prop="result_42_gun">
						<el-input
							v-model="forms.result_42_gun"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="42.195KM(枪)X坐标：" prop="result_42_gun_left">
						<el-input
							v-model="forms.result_42_gun_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="42.195KM(枪)Y坐标" prop="result_42_gun_top">
						<el-input
							v-model="forms.result_42_gun_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="平均配速：" prop="avg_speed_pei">
						<el-input
							v-model="forms.avg_speed_pei"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="平均配速X坐标：" prop="avg_speed_pei_left">
						<el-input
							v-model="forms.avg_speed_pei_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="平均配速Y坐标" prop="avg_speed_pei_top">
						<el-input
							v-model="forms.avg_speed_pei_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="平均时速：" prop="avg_speed_shi">
						<el-input
							v-model="forms.avg_speed_shi"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="平均时速X坐标：" prop="avg_speed_shi_left">
						<el-input
							v-model="forms.avg_speed_shi_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="平均时速Y坐标" prop="avg_speed_shi_top">
						<el-input
							v-model="forms.avg_speed_shi_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="性别净名次：" prop="sex_rank">
						<el-input v-model="forms.sex_rank" placeholder="请输入" clearable style="width: 100%" />
					</el-form-item>
					<el-form-item label="性别净名次X坐标：" prop="sex_rank_left">
						<el-input
							v-model="forms.sex_rank_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="性别净名次Y坐标" prop="sex_rank_top">
						<el-input
							v-model="forms.sex_rank_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="性别枪名次：" prop="sex_rank_gun">
						<el-input
							v-model="forms.sex_rank_gun"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="性别枪名次X坐标：" prop="sex_rank_gun_left">
						<el-input
							v-model="forms.sex_rank_gun_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="性别枪名次Y坐标" prop="sex_rank_gun_top">
						<el-input
							v-model="forms.sex_rank_gun_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="年龄段净名次：" prop="age_rank">
						<el-input v-model="forms.age_rank" placeholder="请输入" clearable style="width: 100%" />
					</el-form-item>
					<el-form-item label="年龄段净名次X坐标：" prop="age_rank_left">
						<el-input
							v-model="forms.age_rank_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="年龄段净名次Y坐标" prop="age_rank_top">
						<el-input
							v-model="forms.age_rank_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="年龄段枪名次：" prop="age_rank_gun">
						<el-input
							v-model="forms.age_rank_gun"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="年龄段枪名次X坐标：" prop="age_rank_gun_left">
						<el-input
							v-model="forms.age_rank_gun_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="年龄段枪名次Y坐标" prop="age_rank_gun_top">
						<el-input
							v-model="forms.age_rank_gun_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
				<el-row type="flex" align="middle">
					<el-form-item label="全部净名次：" prop="all_rank">
						<el-input v-model="forms.all_rank" placeholder="请输入" clearable style="width: 100%" />
					</el-form-item>
					<el-form-item label="全部净名次X坐标：" prop="all_rank_left">
						<el-input
							v-model="forms.all_rank_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="全部净名次Y坐标" prop="all_rank_top">
						<el-input
							v-model="forms.all_rank_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>

				<el-row type="flex" align="middle">
					<el-form-item label="全部枪名次：" prop="all_rank_gun">
						<el-input
							v-model="forms.all_rank_gun"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="全部枪名次X坐标：" prop="all_rank_gun_left">
						<el-input
							v-model="forms.all_rank_gun_left"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
					<el-form-item label="全部枪名次Y坐标" prop="all_rank_gun_top">
						<el-input
							v-model="forms.all_rank_gun_top"
							placeholder="请输入"
							clearable
							style="width: 100%"
						/>
					</el-form-item>
				</el-row>
			</el-card>
		</el-form>
		<el-row type="flex" justify="center" class="footer">
			<el-button style="width: 70px" @click="$router.back()">返回</el-button>
			<el-button
				:loading="false"
				type="success"
				@click="onPreview"
				style="width: 120px; margin: 0 10px 0 20px"
				v-prevent-click="2000"
			>
				预览证书
			</el-button>
			<el-button
				:loading="false"
				type="primary"
				@click="onSubmit"
				style="width: 120px"
				v-prevent-click="2000"
			>
				生成证书
			</el-button>
		</el-row>
		<el-dialog :visible.sync="dialogVisible" title="证书预览" width="700px">
			<img :src="previewUrl" class="pan-img" style="width: 100%" />
		</el-dialog>
	</div>
</template>
<script>
	import { certSave, certPreview, certParams } from '@/api/competition-manage.js'
	export default {
		name: 'CertificationCompetition',
		data() {
			return {
				disabled: false,
				forms: {
					player_name: '',
					player_name_left: '',
					player_name_top: '',
					race_num: '',
					race_num_left: '',
					race_num_top: '',
					player_sex: '',
					player_sex_left: '',
					player_sex_top: '',
					result_5: '',
					result_5_left: '',
					result_5_top: '',
					result_5_gun: '',
					result_5_gun_left: '',
					result_5_gun_top: '',
					result_10: '',
					result_10_left: '',
					result_10_top: '',
					result_10_gun: '',
					result_10_gun_left: '',
					result_10_gun_top: '',
					result_15: '',
					result_15_left: '',
					result_15_top: '',
					result_15_gun: '',
					result_15_gun_left: '',
					result_15_gun_top: '',
					result_20: '',
					result_20_left: '',
					result_20_top: '',
					result_20_gun: '',
					result_20_gun_left: '',
					result_20_gun_top: '',
					result_21: '',
					result_21_left: '',
					result_21_top: '',
					result_21_gun: '',
					result_21_gun_left: '',
					result_21_gun_top: '',
					result_25: '',
					result_25_left: '',
					result_25_top: '',
					result_25_gun: '',
					result_25_gun_left: '',
					result_25_gun_top: '',
					result_30: '',
					result_30_left: '',
					result_30_top: '',
					result_30_gun: '',
					result_30_gun_left: '',
					result_30_gun_top: '',
					result_35: '',
					result_35_left: '',
					result_35_top: '',
					result_35_gun: '',
					result_35_gun_left: '',
					result_35_gun_top: '',
					result_40: '',
					result_40_left: '',
					result_40_top: '',
					result_40_gun: '',
					result_40_gun_left: '',
					result_40_gun_top: '',
					result_42: '',
					result_42_left: '',
					result_42_top: '',
					result_42_gun: '',
					result_42_gun_left: '',
					result_42_gun_top: '',
					avg_speed_pei: '',
					avg_speed_pei_left: '',
					avg_speed_pei_top: '',
					avg_speed_shi: '',
					avg_speed_shi_left: '',
					avg_speed_shi_top: '',
					sex_rank: '',
					sex_rank_left: '',
					sex_rank_top: '',
					sex_rank_gun: '',
					sex_rank_gun_left: '',
					sex_rank_gun_top: '',
					age_rank: '',
					age_rank_left: '',
					age_rank_top: '',
					age_rank_gun: '',
					age_rank_gun_left: '',
					age_rank_gun_top: '',
					all_rank: '',
					all_rank_left: '',
					all_rank_top: '',
					all_rank_gun: '',
					all_rank_gun_left: '',
					all_rank_gun_top: ''
				},
				rules: {
					player_name: [{ required: true, message: '请输入选手姓名', trigger: 'blur' }],
					player_name_left: [{ required: true, message: '请输入姓名X坐标', trigger: 'blur' }],
					player_name_top: [{ required: true, message: '请输入姓名Y坐标', trigger: 'blur' }],
					race_num: [{ required: true, message: '请输入参赛号', trigger: 'blur' }],
					race_num_left: [{ required: true, message: '请输入参赛号X坐标', trigger: 'blur' }],
					race_num_top: [{ required: true, message: '请输入参赛号Y坐标', trigger: 'blur' }],
					player_sex: [{ required: true, message: '请输入性别', trigger: 'blur' }],
					player_sex_left: [{ required: true, message: '请输入性别X坐标', trigger: 'blur' }],
					player_sex_top: [{ required: true, message: '请输入性别Y坐标', trigger: 'blur' }]
				},
				dialogVisible: false,
				previewUrl: ''
			}
		},
		async created() {
			const { race_id } = this.$route.query
			if (race_id) {
				this.getDetailInfo()
			}
		},
		methods: {
			async getDetailInfo() {
				const loading = this.$setLoading()
				try {
					const { data } = await certParams({
						race_id: this.$route.query.race_id,
						group_id: this.$route.query.group_id
					})
					this.forms = !data.length ? {} : data

					loading.close()
				} catch (e) {
					loading.close()
					console.log(e)
				}
			},
			async onPreview() {
				this.$refs.forms.validate(async valid => {
					if (valid) {
						const loading = this.$setLoading({ text: '证书生成中~' })
						try {
							certPreview({
								race_id: this.$route.query.race_id,
								group_id: this.$route.query.group_id,
								...this.forms
							}).then(res => {
								this.previewUrl = res.data.url
								this.dialogVisible = true
							})
							loading.close()
						} catch (e) {
							console.log(e)
							loading.close()
						}
					} else {
						this.$message.warning('请完善信息后提交！')
					}
				})
			},
			async onSubmit() {
				this.$refs.forms.validate(async valid => {
					if (valid) {
						const loading = this.$setLoading({ text: '证书生成中~' })
						try {
							certSave({
								race_id: this.$route.query.race_id,
								group_id: this.$route.query.group_id,
								...this.forms
							}).then(res => {
								this.$message.success(`提交成功！`)
								this.$router.back()
							})
							loading.close()
						} catch (e) {
							console.log(e)
							loading.close()
						}
					} else {
						this.$message.warning('请完善信息后提交！')
					}
				})
			}
		}
	}
</script>
<style lang="scss" scoped>
	.wrap {
		position: relative;
		.info-tlt {
			line-height: 20px;

			&:before {
				content: '';
				float: left;
				width: 4px;
				height: 18px;
				background-color: #37a6e5;
				margin-right: 10px;
			}
		}

		::v-deep {
			.custom-form .el-card__body {
				width: 100%;
				margin: 0 auto;
				padding-bottom: 5px;
			}

			.el-form-item__content {
				min-height: auto;
			}

			.el-form .el-form-item {
				margin-bottom: 18px;
				width: 33%;
			}
			.el-card {
				margin-bottom: 10px;
			}
		}
	}
	.footer {
		width: 100%;
		height: 60px;
		align-items: center;
	}
</style>
